﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }

        public static Dictionary<string, string> users = new Dictionary<string, string>();

        private void Button1_Click(object sender, EventArgs e)
        {
            var uid = textBox1.Text;
            var pwd= textBox2.Text;

            var usr = users.Where(x => x.Key == uid && x.Value == pwd).Select(x => new { key = x.Key, value = x.Value }).FirstOrDefault();

            if(usr!=null)  
            {
                MessageBox.Show("登录成功！","登录提示");
                MainForm form3 = new MainForm();
                this.Hide();
                form3.Show();
            }
            else
            {
                MessageBox.Show("登录失败！","登录提示");
            }
        }

        private void Button2_Click(object sender, EventArgs e)
        {
            RegisterForm form2 = new RegisterForm();
            form2.Show();
        }
    }
}
